<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/admin/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/admin/css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form">
    <form class="layui-form" style="margin: 0 auto;max-width: 460px;padding-top: 40px;">
        <div class="layui-form-item">
            <label class="layui-form-label">商家名称:</label>
            <div class="layui-input-block">
                <div class="layui-form-mid layui-word-aux">{$info.title}</div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">真实姓名:</label>
            <div class="layui-input-block">
                <div class="layui-form-mid layui-word-aux">{$info.full_name}</div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">身份证号:</label>
            <div class="layui-input-block">
                <div class="layui-form-mid layui-word-aux">{$info.full_id}</div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">身份证:</label>
            <div class="layui-input-block">
                <div class="layui-form-mid layui-word-aux">
                    <img src="{$info.full_id_image}" width="60px" onclick="look_pic('{$info.full_id_image}')" >
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">拍摄店面:</label>
            <div class="layui-input-block">
                <div class="layui-form-mid layui-word-aux">
                    <img src="{$info.storefront_image}" width="60px" onclick="look_pic('{$info.storefront_image}')" >
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">工商局:</label>
            <div class="layui-input-block">
                <div class="layui-form-mid layui-word-aux">
                    <img src="{$info.registration}" width="60px" onclick="look_pic('{$info.registration}')" >
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">营业执照:</label>
            <div class="layui-input-block">

                <div class="layui-form-mid layui-word-aux">
                    <img src="{$info.permit_image}" width="60px" onclick="look_pic('{$info.permit_image}')" >
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">服务许可证:</label>
            <div class="layui-input-block">
                <div class="layui-form-mid layui-word-aux">
                    <img src="{$info.restaurant}" width="60px" onclick="look_pic('{$info.restaurant}')" >
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button id="saveButtonYes" type="submit" class="layui-btn layui-btn-normal"><i
                    class="fa fa-check"></i>
                认证通过</button>
                <button id="saveButtonNo" type="submit" class="layui-btn"><i class="fa fa-recycle"></i>
                认证驳回</button>
                <button id="closeButton" type="button" class="layui-btn layui-btn-primary"><i
                    class="fa fa-close"></i>
                关闭</button>
            </div>
        </div>
    </form>

</div>
<script src="/static/admin/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="/static/admin/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
     var look_pic;
      layui.use(['layer', 'form', 'laydate', 'element', 'upload'], function () {

        var $ = layui.$, layer = layui.layer, table = layui.table, laydate = layui.laydate, form = layui.form, upload = layui.upload;
        var indexFrame = parent.layer.getFrameIndex(window.name); //获取窗口索引

        $("#saveButton").on('click', function () {
            var loading = layer.open({ type: 3 });
            $.ajax({
                url: "{:url('add')}",
                type: 'post',
                data: $("#DataForm").serialize(),
                success: function (data) {
                    console.log(data);
                    layer.close(loading);
                    if (data.code == 0) {
                        parent.tableReload();
                        parent.layer.close(indexFrame);
                        parent.layer.msg(data.msg);
                    } else {
                        layer.msg(data.msg);
                    }
                }
            })
            return false;
        })

        $("#closeButton").on('click', function () {
            parent.layer.close(indexFrame);
        })
        look_pic = function (pic) {
                layer.open({
                    type: 1,
                    title: false,
                    closeBtn: 0,
                    area: ['auto'],
                    skin: 'layui-layer-nobg', //没有背景色
                    shadeClose: true,
                    content: '<img src="' + pic + '" style="width:300px;" />'
                });
            };

            $("#saveButtonYes").on('click', function () {
                $.post("{:url('certification')}", { id: "{$info.store_id}", audit: 'yes' },
                    function (data, textStatus, jqXHR) {
                        layer.msg('操作成功');
                    }
                );
                return false;
            })

            
            $("#saveButtonNo").on('click', function () {
                layer.prompt({ title: '请输原因', formType: 2 }, function (text, index) {
                    if (parseFloat(text).toString().length <= 0) return false;
                    layer.close(index);
                    $.post("{:url('certification')}", { audit: 'no', id: "{$info.store_id}", status_fail: text },
                        function (data, textStatus, jqXHR) {
                            layer.msg('操作成功');
                        }
                    );
                });
                return false;
            })

        });
     
</script>
</body>
</html>